<?php
#1. 子类名称与父类名称相同,可以完成重写 overwrite
#2. 不想被继续的类可以用final
#3. 不想被子类重写的方法 用final

class BaseClass {
    public function test() {
        echo "BaseClass::test called\n";
    }

    final public function test1() {
        echo "BaseClass:: test1 called\n";
    }
}

class ChildClass extends BaseClass {
    public function test($tmp) {
        echo "ChildClass::test called  " . $tmp . "\n";
    }

    public function est() {
        echo "ChildClass::test called  " . $tmp . "\n";
    }
}

$obj = new ChildClass();

$obj->test("TMP");
?>
